using System;
using System.Collections.Generic;
using System.Text;
using Framework.Module.CMS.Library.Zones;

namespace Framework.Module.CMS.Library
{
	public class UrlFilter
	{
		public static string BuildUrlByZoneID(int tabId, int zoneId)
		{
            int parentid = getparentid(zoneId);
            if(parentid!=0)
                return "/Home/Default.aspx?tabid=" + tabId + "&zoneid=" + zoneId + "&pzoneid=" + parentid;
            else
			    return "/Home/Default.aspx?tabid=" + tabId + "&zoneid=" + zoneId;
		}
		public static string BuildUrlByDistID(int tabId, int distId)
		{
            return "/Home/Default.aspx?tabid=" + tabId + "&distid=" + distId;
		}

        private static int getparentid(int zoneid)
        { 
            int temp = ZoneController.GetParentID(zoneid);
            int parentid = temp;
            while (temp != 0)
            {
                parentid = temp;
                temp = ZoneController.GetParentID(temp);
            }
            return parentid;
        }
	}
}
